package com.common.controller.base;

import com.common.aop.AuthAOP;
import com.common.aop.CheckToken;
import com.common.controller.JsonResult;
import com.common.controller.ResultCode;
import com.common.entity.User;
import com.common.exception.MyException;
import com.common.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @classDescription:
 * @author:xiayingjie
 * @createTime:16/8/7
 */
@RestController
public class Test1Controller {

    @Autowired
    private MailService mailService;

    @RequestMapping(value = "test1")
 //   @CheckToken
    public JsonResult hello(HttpServletRequest request) throws Exception {
         mailService.sendMail();
//        User user= (User) request.getAttribute(AuthAOP.AUTH_USER);
          return new JsonResult(ResultCode.SUCCESS);
//        int i=1/0;
//        boolean flag=true;
//        if (flag)throw  new MyException(ResultCode.ERROR_USERNAME_PASSWORD);
//        return "hello world";
    }
}
